//
//  EAGLView.h
//  iDemo
//
//  Created by Dr.Watson on 29/05/08.
//  Copyright Passionfools Design 2008. All rights reserved.
//


#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>

#import "SFBattlefield.h"
@class Texture2D;
@class LDSprite;
@class LDSpriteLayer;
@class LDSpritesheet;


//@class SFBattlefield;
//@class LDSound;
/*
 This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
 The view content is basically an EAGL surface you render your OpenGL scene into.
 Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
 */
@interface EAGLView : UIView {

	NSMutableArray *textureArray;
//	id newSprite;
	id testSound;
	id battlefield;
	id invadersSeedLayer;
	id cursorLayer;	
@private
	/* The pixel dimensions of the backbuffer */
	GLint backingWidth;
	GLint backingHeight;
	
	EAGLContext *context;
	
	/* OpenGL names for the renderbuffer and framebuffers used to render to this view */
	GLuint viewRenderbuffer, viewFramebuffer;
	
	/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
	GLuint depthRenderbuffer;
	
	NSTimer *animationTimer;
	NSTimeInterval animationInterval;
	
	LDSpritesheet *spritesheet01;
	
	Texture2D *bg;
	Texture2D *spriteSheet;
	//	Texture2D *sprites;
	LDSprite *sprite01, *sprite02;
	LDSprite *bgSprite;
	LDSpriteLayer *layer01;
	UITextView			*textBox;
	
}

@property NSTimeInterval animationInterval;
- (id)initWithFrame:(CGRect)frame;
- (void)startAnimation;
- (void)stopAnimation;
- (void)drawView;

@end
